package org.secangkirkopipanas.gxtcore.server.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import net.sf.hibernate4gwt.pojo.java5.LazyPojo;

import org.secangkirkopipanas.gxtcore.domain.ISystemApplicationTask;
import org.secangkirkopipanas.gxtcore.domain.ISystemGroup;
import org.secangkirkopipanas.gxtcore.domain.ISystemPermission;

@Entity
@Table(name = "sys_permission")
public class SystemPermission extends LazyPojo implements Serializable,
		ISystemPermission {

	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "id", nullable = false, insertable = true, updatable = true)
	@GeneratedValue(strategy = GenerationType.AUTO)
	private long id;

	@ManyToOne(targetEntity = SystemGroup.class)
	@JoinColumn(referencedColumnName = "id", nullable = false)
	private ISystemGroup group;

	@ManyToOne(targetEntity = SystemApplicationTask.class)
	@JoinColumn(referencedColumnName = "id", nullable = false)
	private ISystemApplicationTask task;

	public SystemPermission() {
	}

	public SystemPermission(ISystemGroup group, ISystemApplicationTask task) {
		this.group = group;
		this.task = task;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public ISystemGroup getGroup() {
		return group;
	}

	public void setGroup(ISystemGroup group) {
		this.group = group;
	}

	public ISystemApplicationTask getTask() {
		return task;
	}

	public void setTask(ISystemApplicationTask task) {
		this.task = task;
	}

}
